<template>
	<view class="toView">
		<view class="header">
			<image src="../../../static/img/quickly/internation/title1@2x.png"></image>
			<view class="information">
				<view class="top">
					<view>会员：{{userInforDetail.realName || ''}}</view>
					<view>年龄：{{userInforDetail.age || ''}}岁</view>
					<view>性别：{{userInforDetail.sex == 1 ? '男' : userInforDetail.sex == 2 ? '女' : '未知'}}</view>
				</view>
				<view class="bottom">
					<view>签发人：{{userInforDetail.operatorName || ''}}</view>
					<view>签发日期：{{userInforDetail.updateTime | filterData2}}</view>
				</view>
			</view>
		</view>
		<view class="two"></view>
		<view class="three"></view>
		
		<view class="mainContent">
			<!-- 基本信息 -->
			<view class="informationBox">
				<view class="boxOne">
					<image src="../../../static/img/quickly/internation/title2@2x.png"></image>
					<view class="style">总体目标是长远的、广义的和比较笼统的预期影响和效果。</view>
				</view>
				<view class="boxTwo">
					<view>{{objective}}</view>
				</view>
			</view>
			
			<!-- 其他信息 -->
			<view class="informationBox">
				<view class="boxOne">
					<image src="../../../static/img/quickly/internation/title3@2x.png"></image>
					<view class="style">具体目标必须是具体的和可以测量的具体项目，包括认知目标、行为目标和健康目标。</view>
				</view>
				<view class="boxTwo">
					<view v-for="(item,index) in specificTarget" :key="index"><rich-text :nodes="item"></rich-text> </view>
				</view>
			</view>
			
			<!-- 其他信息 -->
			<view class="informationBox">
				<view class="boxOne" style="height: 120upx;">
					<image src="../../../static/img/quickly/internation/title4@2x.png"></image>
				</view>
				<view class="boxTwo">
					<view v-for="(item,index) in managePolitic" :key="index"><rich-text :nodes="item"></rich-text> </view>
				</view>
			</view>
			
			<!-- 健康危险干预处方 -->
			<view class="informationBox">
				<view class="boxThree">
					<image src="../../../static/img/quickly/internation/title5@2x.png" style="width: 100%;"></image>
				</view>
				<view class="boxFour">
					<!-- 健康教育处方 -->
					<view class="comment">
						<view  v-for="(item,index) in dangerous" :key="index">
							<view class="health">
								<text class="healthEducation">{{item.name}}</text>
							</view>
							<view class="health_content" v-for="(healthImg,healthindex) in item.data" :key="healthindex">
								<input v-show="false" v-model="healthImg.schemeName" />
								<view class="healthDetails">
									<text>项目：</text>
									<input type="text" class="uni-input" v-model="healthImg.item">
								</view>
								<view class="healthDetails">
									<text>剂量：</text>
									<input type="text" class="uni-input" v-model="healthImg.dosage">
								</view>
								<view class="healthDetails">
									<text>时间：</text>
									<input type="text" class="uni-input" v-model="healthImg.time">
								</view>
								<view class="healthDetails">
									<text>频率：</text>
									<input type="text" class="uni-input" v-model="healthImg.frequency">
								</view>
								<view class="healthDetails">
									<text>注意事项：</text>
									<rich-text :nodes="healthImg.noticeMatters"></rich-text>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import {getUrlParam,filterData,age} from '@/static/js/filter.js';
	export default {
		data() {
			return {
				userInforDetail: {},
				managePolitic:[],
				objective:'',
				specificTarget:'',
				dangerous:[{
					name:'健康教育处方',
					id:'health',
					data:[]
				},{
					name:'运动标准处方',
					id:'exercise',
					data:[]
				},{
					name:'膳食标准处方',
					id:'food',
					data:[]
				}]
			}
		},
		methods: {
			age,
		},
		mounted(){
			const editId = getUrlParam('id')
			this.editId = editId
			const userId = getUrlParam('userId')
			const userName = decodeURI(getUrlParam('userName'))
			this.userId = userId
			this.userName = userName
			this.$api.InterveneSchemeInfo(editId,userId).then((res)=>{
				this.userInforDetail = res.data && res.data.result;
				this.$api.findByUserId(userId).then((ares)=>{
					this.userInforDetail.age = ares.data.result.age
				})
				this.objective = res.data.result.objective;
				this.specificTarget = res.data.result.specificTarget && JSON.parse(res.data.result.specificTarget).map((a,ai)=>{
					return a.value
				})
				this.managePolitic = res.data.result.managePolitic && JSON.parse(res.data.result.managePolitic).map((a,ai)=>{
					return a.value
				})
				res.data.result.schemeDetails.map(a=>{
					this.dangerous[Number(a.schemeName)-1].data.push(a)
				})
			})
		},
	}
</script>

<style lang="scss" scoped>
	@import "@/static/css/quickly/Intervention/toView.scss" ;
</style>
